package com.qiang;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Test02 {
    public static void main(String[] args) {
        String s = "I loved.. Phoenix. 'I loved the sun and the blistering heat. ";
        String[] s2 = s.split(" ");

        ArrayList<String> array = new ArrayList<>();
        for (int i = 0; i < s2.length; i++) {
            if (s2[i].length() == 0) {
                continue;
            }

            char c = s2[i].charAt(s2[i].length() - 1);//最后一位
            char c1 = s2[i].charAt(0);//第一位
            boolean b = c >= 'a' | c >= 'A';
            boolean d = c1 >= 'a' | c1 >= 'A';

            if (s2[i].length() > 3) {
                char c3 = s2[i].charAt(s2[i].length() - 2);//倒数第二位
                boolean e = (c3 >= 'a' || c3 >= 'A');//倒数第二位
                if (b == false & e == false) {
                    String st1 = s2[i].substring(0, s2[i].length() - 2);
                    array.add(st1);
                }
            } else if (b == false) {
                String st1 = s2[i].substring(0, s2[i].length() - 1);
                array.add(st1);
            } else if (d == false) {
                String st1 = s2[i].substring(1, s2[i].length());
                array.add(st1);
            } else {
                array.add(s2[i]);
            }


      /*  for (int i = 0; i < s2.length; i++) {
            //System.out.println(s2[i]);
            char c = s2[i].charAt(s2[i].length() - 1);
            boolean b = c >= 'a' || c >= 'A';
            if (b == false) {
                String st = s2[i].substring(0, s2[i].length() - 1);
                array.add(st);
            } else {
                array.add(s2[i]);
            }
        }
        for (String s1 : array) {
            System.out.println(s1);
        }*/

       /* char c = s.charAt(s.length() - 1);
        boolean b = c >= 'a' || c >= 'A';
        if (b == false) {
            String ss = s.substring(0, s.length() - 2);
            array.add(ss);
        }
        for (String s1 : array) {
            System.out.println(s1);
        }*/
            //System.out.println(c);
      /*  //boolean b = (s.endsWith() >= 'a' || s.endsWith() >= 'z');
        boolean a = s.startsWith("a");
        System.out.println(a);*/
     /* String s = "234";
      if(Integer.valueOf(s)>=300){
          System.out.println(true);
      }else{
          System.out.println(false);
      }*/

        }
        for (String s1 : array) {
            System.out.println(s1);
        }
    }
}
